# coding=utf-8
import maya.cmds as cmds
import maya.mel as mel
import os
import time
import core as timelimit
from pipeline.pipeline_Path import *
#def GetCamera():
#	cmds.ls(type ='camera' )
#	perspCameras = cmds.listCameras( p=True )
#	persp = ['persp']
#	camera = set(perspCameras) - set(persp)
#	camera = list(camera)
#	return camera
	
def ThreeCamera_win():
	if timelimit.ProductActivation().Win() == 0:
		return
	CamwindowName = 'ThreeCamera'
	if cmds.window (CamwindowName,ex = 1):
		cmds.deleteUI (CamwindowName)
	cmds.window (CamwindowName,sizeable=1)
	TSLength =cmds.optionVar (q ='timeSliderLength')
	cmds.paneLayout('ThreeCameraPaneLayout',w=int(LocalPath_ProjectSettingRead("ImageWidth"))/2.5,h=int(LocalPath_ProjectSettingRead("ImageHeight"))/2.5)
	a=cmds.modelPanel(mbv=0,editString = 0)

	barLayout = cmds.modelPanel(a, q=1, bl=1)
	toDelete = cmds.frameLayout(barLayout, q=1, childArray=1)
	cmds.deleteUI(toDelete)
	
	cmds.ls (type = 'camera')
	perspCameras = cmds.listCameras (p = True)
	persp = ['persp']
	camera = set (perspCameras) - set (persp)

	listCams = list (camera)

	for i in range(len(listCams)):
		print listCams[i]
		cmds.setFocus(a)
		cmds.setAttr(listCams[i] + ".displayGateMask", 0)
		cmds.setAttr(listCams[i] + ".displayFilmGate", 0)
		cmds.setAttr(listCams[i] + ".displaySafeAction", 0)
		
		cmds.modelEditor( a, edit=True, camera= listCams[i],pluginObjects =['gpuCacheDisplayFilter' ,1],displayAppearance = 'points',rnm='vp2Renderer',dimensions=0,polymeshes =1,deformers =0,textureDisplay = 'modulate',displayTextures = 1,shadows = 0,textures = 0,joints = 0,jointXray = 0,imagePlane = 0,ikHandles = 0,nurbsCurves = 0,objectFilterShowInHUD = 0)#headsUpDisplay = 0,
	#barLayout = cmds.modelPanel(a, q=1, bl=1)

	#toDelete = cmds.frameLayout(barLayout, q=1, childArray=1)
	
	#cmds.timePort( snap=1 ,w= TSLength,h=40,backgroundColor=[0.4,0.4,0.4])
	
	#cmds.deleteUI(toDelete)
	cmds.showWindow(CamwindowName)
#ThreeCamera_win()